package com.xiaodu.acer.phoneplay.ui.base;

import android.app.Activity;
import android.content.Context;
import android.support.v4.app.Fragment;

/**
 * Name: 杜志斌
 * Time: 2017/4/25.
 * Dec:
 */
public abstract class BasePresenter<M, V> {

    protected Context mContext;
    protected M mModel;
    protected V mView;

    public BasePresenter(M model, V view) {
        this.mModel = model;
        this.mView = view;
        this.initContext();
    }

    /**
     * 判断是Fragment还是Activity
     */
    public void initContext() {
        if (mView instanceof Fragment) {
            mContext = ((Fragment) mView).getActivity();
        } else {
            mContext = (Activity) mView;
        }
    }


}
